<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>货存物品</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="货存,物品">
	<meta http-equiv="description" content="This is my page">
	
  </head>
  
  <body>
    <center>
    	<s:form name="frm" id="frm" method="post" action="stockObjManage.action" namespace="/inner/stock">
    		<jsp:include page="/jsp/outward/business/common/menuLink.jsp">
    			<jsp:param name="menuLink" value="[{'name':'货存管理'},{'name':'货存物品'}]"/>
    			<jsp:param name="width" value="40%"/>
    		</jsp:include>
    		
    		<s:hidden id="kindergartenId" name="kindergartenId"></s:hidden>
    		
    		<table cellspacing="1" width="100%" bgcolor="#CCCCCC">
				<tr bgcolor="#FFFFFF">
					<td align="right" width="10%" class="label">
						名称：
					</td>
					<td align="left" width="23%">
						<s:textfield name="objvo.stockObj.objName" id="objName" cssStyle="width:80%" cssClass="search"></s:textfield>
					</td>
					<td align="right" width="10%" class="label">
						单价：
					</td>
					<td align="left" width="23%">
						<s:textfield name="objvo.priceStart" id="priceStart" cssStyle="width:80px" cssClass="search"></s:textfield>
						-
						<s:textfield name="objvo.priceEnd" id="priceEnd" cssStyle="width:80px" cssClass="search"></s:textfield>
					</td>
					<td align="right" width="10%" class="label">
						库存：
					</td>
					<td align="left" width="24%">
						<s:textfield name="objvo.stockCountStart" id="stockCountStart" cssStyle="width:80px" cssClass="search"></s:textfield>
						-
						<s:textfield name="objvo.stockCountEnd" id="stockCountEnd" cssStyle="width:80px" cssClass="search"></s:textfield>
					</td>
				</tr>
			</table>
    		
    		<table cellspacing="0" width="100%">
				<tr>
					<td align="left">
						<input type="button" value="查询" class="btn" onclick="searchThis()"/>
						<input type="button" value="新增" class="btn" onclick="toAddStockObj()"/>
						<input type="button" value="删除" class="btn" onclick="delStockObj()"/>
						<input type="button" value="重置" class="btn" onclick="resetSearch()"/>
					</td>
				</tr>
			</table>
    		<table width="100%" cellspacing="1" cellpadding="3" bgcolor="#CCCCCC">
    			<tr class="tableHead" align="center">
    				<td width="8%">
    					<input type="checkbox" id="cbAll" onclick="cbCheck(this, 'objIds')" />
    				</td>
    				<td width="8%">
    					序号
    				</td>
    				<td width="20%">
    					名称
    				</td>
    				<td width="18%">
    					单价
    				</td>
    				<td width="18%">
    					库存
    				</td>
    				<td width="18%">
    					单位
    				</td>
    				<td width="10%">
    					操作
    				</td>
    			</tr>
    			<s:iterator value="lp.list" status="s">
    				<tr align="center"
    					<s:if test="#s.index%2==0">class="tableRow2" onMouseMove="this.className='tableRow3'" onMouseOut="this.className='tableRow2'"</s:if>
						<s:else>class="tableRow1" onMouseMove="this.className='tableRow3'" onMouseOut="this.className='tableRow1'"</s:else>
    				>
    					<td>
	    					<input type="checkbox" value="<s:property value='id' />" name="objIds" />
	    				</td>
    					<td>
    						<s:property value="(pager.thisPage - 1) * pager.pageSize + #s.index + 1" />
    					</td>
    					<td>
    						<s:property value="objName"/>
    					</td>
    					<td>
    						<s:property value="price"/>
    					</td>
    					<td>
    						<s:property value="stockCount"/>
    					</td>
    					<td>
    						<s:property value="unit"/>
    					</td>
    					<td>
    						<a href="javascript:toUpdateStockObj('<s:property value="id" />')">修改</a>
    					</td>
    				</tr>
    			</s:iterator>
    			<jsp:include page="/common/pager/pager.jsp">
					<jsp:param name="formName" value="frm" />
					<jsp:param name="id" value="1" />
				</jsp:include>
    		</table>
    	</s:form>
    </center>
    
    <script type="text/javascript">
    function toAddStockObj()
    {
    	var kgId = getTopKg();
    	var url = realPath + '/inner/stock/toAddStockObj.action?kindergartenId=' + kgId;
    	openWin(url, 700, 400, 'yes', 'yes');
    }
    
    function toUpdateStockObj(id)
    {
    	var kgId = getTopKg();
    	var url = realPath + '/inner/stock/toUpdateStockObj.action?stockObj.id=' + id + '&kindergartenId=' + kgId;
    	openWin(url, 700, 400, 'yes', 'yes');
    }

    function delStockObj()
    {
    	var flag = hasCheck('objIds');
    	if(flag == false)
    	{
    		return;
    	}
    	showConfirm('确认删除？', function(v){
    		if(v == true)
    		{
    			var url = 'inner/stock/delStockObj.action';
		    	ajaxAction(url, 'post', 'frm', false, function(){
	    			searchThis();
		    	});
    		}
    	});
    }
    
    function searchThis()
    {
    	$('#thisPage').val(1);
    	$('#frm').submit();
    }
    </script>
  </body>
</html>
